<template>
  <a-modal
    :maskClosable="false"
    :destroyOnClose="true"
    title="入会审核"
    centered
    :width="600"
    v-model="visible"
  >
    <a-form-model ref="ruleForm" :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">
      <a-form-model-item label="审核状态">
        <a-radio-group v-model="form.status">
          <a-radio :value="1">通过</a-radio>
          <a-radio :value="2">驳回-完善资料</a-radio>
          <a-radio :value="3">终止审核</a-radio>
        </a-radio-group>
      </a-form-model-item>
      <a-form-model-item label="审核备注">
        <a-textarea v-model="form.remark" placeholder="请输入审核备注" :rows="4" />
      </a-form-model-item>
    </a-form-model>
    <template slot="footer">
      <a-button @click="visible = false">取消</a-button>
      <a-button class="_ml-10" type="primary" @click="submitForm">确认</a-button>
    </template>
  </a-modal>
</template>

<script>
import { memberApplyReview } from '@/api/member/member'
export default {
  data() {
    return {
      labelCol: { span: 4 },
      wrapperCol: { span: 14 },
      visible: false,
      form: {
        id: undefined,
        status: 1,
        remark: undefined,
      },
    }
  },
  methods: {
    show(id) {
      this.form.id = id
      this.form.status = 1
      this.form.remark = undefined
      this.visible = true
    },
    async submitForm() {
      let { code, msg } = await memberApplyReview({ ...this.form })
      this.$message[code === 0 ? 'success' : 'error'](msg)
      if (code === 0) {
        this.$emit('success', this.form.status === 1)
        this.visible = false
      }
    },
  },
}
</script>

<style>
</style>